//
//  UIButton+Extension.swift
//  HXWeibo
//
//  Created by HX on 15/12/8.
//  Copyright © 2015年 HX. All rights reserved.
//

import UIKit

extension UIButton
{
    /// 在扩展里面构造函数只能是便利构造函数
    convenience init(imageName: String, title: String, textColor: UIColor = UIColor.lightGrayColor(), fontSize: CGFloat = 12)
    {
        self.init()
        
        //按钮图片
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        
        //按钮文字
        self.setTitle(title, forState: UIControlState.Normal)
        
        //文字颜色
        self.setTitleColor(textColor, forState: UIControlState.Normal)
        
        //文字大小
        self.titleLabel?.font = UIFont.systemFontOfSize(fontSize)
    }
}



































 